﻿{$header}
<div id="main" class="main" >
    <div class="content">
  <h3 class="heading">采购单{$vo.mano}--收货处理 [ <a href="__URL__">返回列表</a> ]</h3>
<div id="result" class="result none"></div>
<form class="form-horizontal well" method='post' id="form1" name="form1" action="__URL__/update/">
<table cellpadding=3 cellspacing=3 >
<tr>
    <td>销售订单号</td><td><a href="__APP__/Order/detail/id/{$vo.order_id}"> {$vo.order_id|getModelName='Order','mano'} </a></td>
</tr>  
<tr>
    <td width="150px">采购单号：</td>
  <td>
            {$vo.mano}
            <span class="offset1">采购时间：</span> {$vo.create_time|toDate}
        </td>
</tr>
<tr>
    <td class="tRight" width="150px">供应商：</td>
    <td class="tLeft" >{$vo.supplier_id|getModelName='Supplier'}
            联系人:{$vo.supplier_id|getModelName='Supplier','contact_id'|getContactInfo}
        </td>
</tr>
  <tr>
    <td>产品</td>
    <td>{$vo.product_id|getPfullName} (CAS:{$vo.product_id|getCas})<img src="__PUBLIC__/Uploads/product/{$vo.product_id|getCas}.jpg"></td>
  </tr>
    
 <tr>
     <td>单价</td><td>{$vo.price} 元
     <strong>规格</strong> {$vo.specification|getModelName='Specification'}</td>
 </tr>
<tr>
     <td>数量</td><td>
     {$vo.number}KG</td>
 </tr>
 <tr>
     <td>要求交货期</td><td>{$vo.delivery_date|toDate='Y-m-d'}
     </td>
 </tr>
 <tr>
     <td>是否有货前样</td><td>{$vo.with_sample} {$vo.sample_loginfo} 
     </td>
 </tr>
<tr>
     <td>分析单</td><td>
 <input class="offset1" type="checkbox" name="analysis_sheet" <eq name="vo.analysis_sheet" value="1">checked</eq> >分析单
     </td>
 </tr>
 <tr>
     <td>已付款金额</td>
     <td>
         <div class="input-append">{$vo.first_pay}
             <span class="add-on">元</span>
         </div>
     </td>
 </tr>
 <tr>
     <td>快递公司</td>
     <td>{$vo.logi_id|getConfigVal='chinalogi'}

        快递单号：{$vo.logi_no}
        运费 :{$vo.logifee}<span class="add-on">元</span>
     </td>
 </tr>
 <tr>
    <td>预计到货期</td>
    <td>{$vo.expect_date|toDate='Y-m-d'}
    </td>
</tr>
<tr>
  <td class="tRight" >经办人：</td>
  <td class="tLeft" >{$vo.user_id|getModelName='User'}
        </td>
</tr>
<tr>
     <td>质检指南</td><td>{$vo.qc_guide}
     </td>
 </tr>
 <tr>
     <td>货前样送检物流信息</td><td><input type="text" name="sample_test_loginfo" value="{$vo.sample_test_loginfo}"> </td>
 </tr>
 <tr>
     <td>货物送检物流信息</td>
     <td> <input type="text" name="goods_test_loginfo" value="{$vo.goods_test_loginfo}">  </td>
 </tr>
<tr>
  <td class="tRight">备注：</td>
        <td class="tLeft">{$vo.remark}
        </td>
</tr>
<tr>
  <td class="tRight">收货备注：</td>
        <td class="tLeft"> <textarea name="receive_remark">{$vo.receive_remark}</textarea> 
        </td>
</tr>
<tr>
    <td>货前样收到</td> <td> <a class="btn btn-primary" href="__URL__/sample_got/id/{$vo.id}">货前样收到</a>  </td>
</tr>
<tr>
    <td>收货数量：</td>
    <td>
      <eq name="vo.receive_number" value="0">
              <input type="text" name="receive_number" value="{$vo.number}">KG
              <else/>{$vo.receive_number} KG
            </eq>
        
         </td>
</tr>
<tr><td>收货时间：</td>
    <td>{$vo.receive_time|toDate}</td>
</tr>
<tr>
    <td>收货人：</td>
    <td><empty name="vo.receive_user">
           <input type="hidden" name="receive_user" value="{$_SESSION[C('USER_AUTH_KEY')]}">
        </empty>
        {$vo.receive_user|getModelName='User'} </td>
</tr>
<tr>
    <td>质检状态</td>
    <td>
        入库质量控制：{$vo.in_qc_status|getConfigVal='inQcStatus'}
        &nbsp;&nbsp;货前样质量控制:{$vo.sample_qc_status|getConfigVal='sampleQcStatus'}
        <p>样品送检时间：{$vo.sample_to_test_time|toDate}</p>
        <p>样品收到时间：{$vo.sample_got_time|toDate}</p>
    </td>
</tr>

<tr><td>收货状态：</td>
    <td>
            {$vo.status|getConfigVal='buyStatus'}
           
        
   </td> 
</tr>
<tr>
	<td></td>
	<td class="center" width="300">
    <input type="hidden" value="__SELF__" name="jumpUrl">
        <input type="hidden" value="{$vo.id}" name="id">
	<button type="submit" class="btn btn-primary"><i class="icon-ok icon-white"></i> 保存</button>
	<button type="reset" onclick="javascript:history.back()" class="btn btn-primary offset1"><i class="icon-arrow-left icon-white"></i> 返回</button>
	</td>
</tr>


</table>
</form>
<table>
<tr>
    <td>收货操作&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
    <td>
        <gt name="vo.status" value="7">
            <!--如果是拒绝入库，则出现重新入库的按钮-->
            <eq name="vo.status" value="9">
                <a href="#" onclick="javascript:in_house({$vo.id})" class="btn btn-primary">重新入库</a>
                <else/>
                {$vo.status|getConfigVal='buyStatus'}
            </eq>

            
            <else/>
                    <eq name="vo.status" value="5">
                        <form action='__URL__/Update' method='post' id='form6' name='form_status' class="search-form pull-right  offset2">
                          <input type='hidden' value='{$vo.id}' name='id'>
                          <input type='hidden' name='status' value='6'>
						  <input type='hidden' name='receive_time' value='{:time()}'>
                        <a href="#" onclick="javascript:setNewValue({$vo.id},6)" class="btn btn-primary">足量到货</a></form>
                        <form action='__URL__/Update' method='post' id='form7' name='form_status' class="search-form pull-left">
                          <input type='hidden' value='{$vo.id}' name='id'>
                          <input type='hidden' name='status' value='7'>
						  <input type='hidden' name='receive_time' value='{:time()}'>
                        <a href="#" onclick="javascript:setNewValue({$vo.id},7)" class=" offset1 btn btn-primary">缺量到货</a></form>
                        <else/>
                        <if condition="($vo.status eq 6 ) OR ($vo.status eq 7) ">
                            <a href="#" onclick="javascript:in_house({$vo.id})" class="btn btn-primary">入库</a>
                        <form action='__URL__/Update' method='post' id='form9' name='form_status' class="search-form pull-right  offset2">
                          <input type='hidden' value='{$vo.id}' name='id'>
                          <input type='hidden' name='status' value='9'>
                            <a href="#" onclick="javascript:setNewValue({$vo.id},9)" class=" offset1 btn btn-primary">拒绝入库</a>
                        </form>
                        
                        </if>
                    </eq>
        </gt>
    </td>
</tr>
</table>
<notempty name="vo.order_detail_id">
<?php 
$msgs = M('Message')->where('obj_type="Order_detail" and obj_id ='.$vo['order_detail_id'])->order('create_time desc')->findAll();
        
 ?>
<table class="table table-bordered">
  <tr class="alert alert-info"><td colspan=5>订单备注</td>
    <td><a class="btn btn-primary" href="__APP__/Message/add/obj_type/Order_detail/depart/仓库/obj_id/{$vo.order_detail_id}/return_type/Receive/return_id/{$vo.id}"><i class="icon-comment icon-white"></i> 创建备注</a></td> 
  </tr>
  <tr> <td>编号</td><td>部门</td><td>留言</td><td>操作人</td>  <td>日期</td><td>修改</td> </tr>
  <!--order by create time desc-->
  <volist name="msgs" id="msg">
    <eq name="_SESSION[C('USER_AUTH_KEY')]" value="$msg.user_id"> 
      <form action="__APP__/Message/update" method="post" id="msg"
      <tr>
        <td> <input type="hidden" name="id" value="{$msg.id}">
          <input type="hidden" name="jumpUrl" value="__SELF__">
          {$msg.id}</td>
        <td>{$msg.depart}</td>
        <td><textarea name="content" class="input-xxlarge" rows="4">{$msg.content}</textarea> </td>
        <td>{$msg.user_id|getModelName='User'}</td>
        <td>{$msg.create_time|toDate}</td>
        <td> <input type="submit" class="btn btn-primary" value="修改"> </td>
      </tr>
      </form>
    <else/>
    <tr>
      <td>{$msg.id}</td>
      <td>{$msg.depart}</td>
      <td>{$msg.content}</td>
      <td>{$msg.user_id|getModelName='User'}</td>
      <td>{$msg.create_time|toDate}</td>
      <td> ---</td>
    </tr>
  </eq>
  </volist>
</table>
</notempty>
</div>
</div>
</div>
<include file="Public:footer" />
<link rel="stylesheet" type="text/css" href="__PUBLIC__/Js/easyui/themes/default/easyui.css">
<script type="text/javascript" src="__PUBLIC__/Js/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/Js/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/Js/filter-product.js"></script>
<load href="__PUBLIC__/Js/My97DatePicker/WdatePicker.js" />
<script type="text/javascript">
    function setNewValue(id,newValue){
        if (window.confirm('确定要进行下一步操作吗？'))
        {
            $('#form'+newValue).submit();
        }else
           return false;
    }
    //货前样送检
    function setSampleTestValue(id){
        if (window.confirm('确定货前样要送检吗？'))
        {
            location.href="__APP__/Buy/setFieldValue/id/"+id+"/field/sample_qc_status/new/2";
        }
    }
    //货物送检
     function setGoodsTestValue(id){
        if (window.confirm('确定货物要送检吗？'))
        {
            location.href="__APP__/Buy/setFieldValue/id/"+id+"/field/in_qc_status/new/2";
        }
    }

     function in_house(id){
        if (window.confirm('确定要入库吗？'))
        {
          location.href = URL+"/in_house/id/"+id;
        }
    }
</script>
